
$.mobile.transitionFallbacks.slide = "none";
$.mobile.buttonMarkup.hoverDelay = "false";
function goTo(page , isRef) {
	$.mobile.changePage(page, {reloadPage: isRef,transition:'slide'});
}
function networkConnection() {
	var states = {};
	states[Connection.UNKNOWN]  = '未知连接';
	states[Connection.ETHERNET] = '以太网';
	states[Connection.WIFI]     = 'WiFi';
	states[Connection.CELL_2G]  = '2G网络';
	states[Connection.CELL_3G]  = '3G网络';
	states[Connection.CELL_4G]  = '4G网络';
	states[Connection.NONE]     = '无网络连接';
	if(states[navigator.network.connection.type].toString()=="无网络连接"){
	   navigator.notification.alert( "请设置可用网络连接？", alertDismissed, "提示", "确定");
    }
	else{
		return true;
	}
 }

function goTo(page , isRef) {
	$.mobile.changePage(page, {reloadPage: isRef,transition:'slide'});
}

function onLoad() {          
    document.addEventListener("deviceready", onDeviceReady, false); 
} 

function exitApp() {
	navigator.notification.confirm("您确认要退出系统吗？", exitConfirm, "温馨提示", "确认,取消");
}

function CancellApp(){
	navigator.notification.confirm("您确认要注销系统吗？", cancelConfirm, "温馨提示", "确认,取消");
}

function rememberUserInfo(){
	window.localStorage.setItem("user",$("#cbxuser").is(":checked") ? $("#user").val() :"");
	window.localStorage.setItem("password",$("#cbxpwd").is(":checked") ? $("#password").val() :"");
	window.localStorage.setItem("cbxuser",$("#cbxuser").is(":checked") ? true:false);
	window.localStorage.setItem("cbxpwd",$("#cbxpwd").is(":checked") ? true:false);
}

function initApp(){
	$("#cbxuser").attr("checked",window.localStorage.getItem("cbxuser")=='true' ? true:false).checkboxradio("refresh");
	$("#user").attr("value",window.localStorage.getItem("user"));
	$("#cbxpwd").attr("checked",window.localStorage.getItem("cbxpwd")=='true' ? true:false).checkboxradio("refresh");
	$("#password").attr("value",window.localStorage.getItem("password"));
}


function onDeviceReady() {               
    document.addEventListener("backbutton", onBackKeyDown, false); 
} 

function onBackKeyDown() { 
    navigator.notification.confirm("您确认要退出系统吗？", exitConfirm, "温馨提示", "确认,取消");
} 

function exitConfirm(buttonIndex){
	if (buttonIndex == 1) {
         zb.submit(zb.global.menu.body.sys.exiturl,'init' , 'init', '' , '' , zb.global.menu.header.session, 'exit','exit');
	}
}

function cancelConfirm(buttonIndex){
	if (buttonIndex == 1) {
		goTo("login.html",false);
	}
}

//页面加载样式
function showLoader() {
    //显示加载器
    $.mobile.loading('show', {  
        //text: '努力加载中...', //加载器中显示的文字  
        textVisible: true, //是否显示文字  
        //theme: 'b',        //加载器主题样式a-e  
        textonly: false,   //是否只显示文字  
        html:'<div style="text-align:center"><img src="image/bigloading.gif" width="48" height="48"/></div>'           //要显示的html内容，如图片等  
    });  
}  
  
//隐藏加载器 
function hideLoader()  
{  
    $.mobile.loading('hide');  
} 


/*function loadList(url,obj){
	$(obj).addClass("btn-active").siblings("li").removeClass("btn-active");
	var html=""
	zb.submit(url,'report' , 'init', 'refresh' , '' , zb.global.session, 'route','list');
	  var table = zb.global.sdata.body.source.table;
	  var rows = table.rows;
  	  var cols = table.cols;
   	  var fields =table.layout.fields;   	
		  for(var n=0;n<rows.length;n++){  
			  html+="<table class='table tb_3'>";
			  html+="<tr>";
			  for(var k=0;k<fields.length;k++){
				   var idx = 0;
				   for(var m=0;m<cols.length;m++){
					   if (fields[k].text == "{@"+cols[m].id+"}"){	idx = m; }
				   }   
				   html+="<td>"+rows[n][idx]+"</td>";	
				   switch( table.layout.uitype){
					   	  case "report.list.notice":
					   		  if (k==1 || k ==2 ){html+="</tr>";}
					   		  break;
					   	  default:
					}
			  }
		  }
		  
		  html+="</table>";
		  alert(html)
		  $("#module").empty().append(html);
   	  }	*/

